package java_DesignPattern.CreatorPattern.BuilderPattern.Method2;

/**
 * 产品类---手机
 */
public class Phone {

    private String cpu;
    private String memory;
    private String screen;

    private Phone(Create create) {
        this.cpu = create.cpu;
        this.memory = create.memory;
        this.screen = create.screen;
    }

    @Override
    public String toString() {
        return "Phone{" +
                "cpu='" + cpu + '\'' +
                ", memory='" + memory + '\'' +
                ", screen='" + screen + '\'' +
                '}';
    }

    public static final class Create{
        private String cpu;
        private String memory;
        private String screen;

        public Create cpu(String cpu){
            this.cpu = cpu;
            return this;
        }

        public Create memory(String memory) {
            this.memory = memory;
            return this;
        }

        public Create screen(String screen) {
            this.screen = screen;
            return this;
        }

        public Phone build(){
            return new Phone(this);
        }
    }
}
